# encoding = utf-8
class Article < ActiveRecord::Base
  belongs_to :category
  has_many :comments

  validates :title, :presence  => true
  
  rss_me

  scope :rss_limit, { :limit => 10 }

  def previous_post
    self.class.first(:conditions => ["id < ? and category_id = ?", id, category], :order => "id desc")
  end

  def next_post
    self.class.first(:conditions => ["id > ? and category_id = ?", id, category], :order => "id asc")
  end
  
end
